Repository navigation
enhance: add source config preservation in save_model and related tests - #2522
Conversation
Signed-off-by: Xin He <xin3.he@intel.com>
There was a problem hiding this comment.
🟡 Changes recommended
Three moderate issues remain in source-config handling and in-place saves.
1 open issue
What changed in this PR
Preserves source config.json during model export while updating quantization metadata and adding tests.
Changes:
- Adds local/remote source-config preservation with fallback behavior.
- Integrates preservation into
save_model. - Adds coverage for preservation and fallback scenarios.
| File | Summary | Findings |
|---|---|---|
auto_round/export/utils.py |
Implements source configuration loading and preservation. | Three moderate issues: JSON source files are treated as Hub IDs (1 vote); stale quantization_config is retained when removed (2 votes); in-place saves can overwrite the source before preservation (1 vote). |
test/unit/common/export/test_export_utils.py |
Tests source configuration preservation and fallback cases. | No findings. |
Review effort: Lite
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
n1ck-guo
left a comment
There was a problem hiding this comment.
LGTM.
Should we extend this algorithm by incorporating some of the code from save_config_artifact? For example,when exception, try model.save_config / config.save_pretrained as line 90-111
Thanks for the suggestion. This fallback is already wired through |
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |

Description
Sometimes, the saved config is not suitable for re-loading. we should avoid this issue ahead.
Type of Change
Refactor
Related Issues
Fixes or relates to #2521
Checklist Before Submitting
/azp run Unit-Test-CUDA-AutoRound.